package com.wit.witmg.api;


import com.wit.witmg.service.ITMonitElectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 电耗监测记录表（流程数据） 前端控制器
 * </p>
 *
 * @author bob
 * @since 2025-08-20
 */
@RestController
@RequestMapping("monitelect")
@Api(tags = "电耗监测记录API")
public class MonitElectController {
    @Resource
    private ITMonitElectService service;
    @ApiOperation("新增/修改")
    @PostMapping("add")
    public Object add(HttpServletRequest request,
                      @RequestParam("json") String json) {
        return service.add(request,json);
    }

    @ApiOperation("查询")
    @PostMapping("get")
    public Object get(HttpServletRequest request,
                      @RequestParam(value = "dt0",required = false) Long dt0,
                      @RequestParam(value = "dt1",required = false) Long dt1,
                      @RequestParam(value = "sid",required = false) String sid,
                      @RequestParam(value = "bn",required = false) String bn) {
        return service.get(request,dt0,dt1,sid,bn);
    }

    @ApiOperation("删除")
    @PostMapping("del")
    public Object del(HttpServletRequest request,
                      @RequestParam("id") Integer id) {
        return service.del(request,id);
    }
}
